package com.taoyibao.hongcanting.ui.entertainment.activity;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.taoyibao.hongcanting.base.activity.BaseActivityPresenter;
import com.taoyibao.hongcanting.base.delegate.WebViewDelegate;
import com.taoyibao.hongcanting.cache.SpUtils;
import com.taoyibao.hongcanting.constant.ApiRoute;
import com.taoyibao.hongcanting.constant.CodeConstant;

/**
 * @author TangAnna
 * @description: 排行榜的二级页面
 * @date :${DATA} 14:57
 */
public class LeaderboardSecondaryActivity extends BaseActivityPresenter<WebViewDelegate> {
    @Override
    protected Class<WebViewDelegate> getDelegateClass() {
        return WebViewDelegate.class;
    }


    /**
     * @param context
     * @param type    h5传递过过来的值
     */
    public static void open(Context context, String type) {
        Intent intent = new Intent(context, LeaderboardSecondaryActivity.class);
        intent.putExtra(CodeConstant.KEY, type);
        context.startActivity(intent);
    }

    @Override
    protected void bindEvenListener() {
        super.bindEvenListener();
        viewDelegate.setBackHeadGray();
        String type = getIntent().getStringExtra(CodeConstant.KEY);
        if (TextUtils.equals(type, "1")) {
            viewDelegate.setTitle("充值排行日榜");
        } else if (TextUtils.equals(type, "2")) {
            viewDelegate.setTitle("消费排行日榜");
        } else if (TextUtils.equals(type, "3")) {
            viewDelegate.setTitle("充值排行总榜");
        } else if (TextUtils.equals(type, "4")) {
            viewDelegate.setTitle("消费排行总榜");
        }
        viewDelegate.setWebViewLoadUrl(ApiRoute.LEADER_BOARD_SECONDARY_WEB_PATH + "?token=" + SpUtils.getToken() + "&type=" + type);

    }
}
